/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"3042EF7F-AF51-4259-9EBD-BAFEEF5871D9",variableType:4}
 */
var fControl = 0;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"CD593B3B-0DA2-4BA5-9E9D-31AB4AE7700A"}
 */
var fPass1 = null;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"91DEC234-C100-4B24-AE96-6926E465C556"}
 */
var fPass2 = null;

/**
 * @properties={typeid:24,uuid:"C0CEF0CC-B448-48F9-92CC-B00F3623FE2B"}
 */
function cambiarPass(event) {
	if(fPass1 == fPass2)
	{
		var p = utils.stringMD5HashBase64(fPass1)
		hash_pass = p
		fPass1 = null
		fPass2 = null
		fecha_cambio_pass = application.getServerTimeStamp()
		databaseManager.saveData()
		fControl = 1
		var $win = application.getWindow('CAMBIO_PASS')
		$win.hide()
		$win.destroy()
	}
	else
	{
		fPass1 = null
		fPass2 = null
		globals.DIALOGS.showErrorDialog('Error','Verificacion de contraseña fallo','OK')
	}
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"E4BD1A95-5FC7-4A40-A177-E440358E78C4"}
 */
function onHide(event) {
	if (fControl == 1)
	{
		fControl = 0
		return true
	}
	return false
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"8B8D3175-97D5-4259-AE9A-B7728A27CA2F"}
 */
function cancelar(event) {
	fControl = 1
	var $win = application.getWindow('CAMBIO_PASS')
	$win.hide()
	$win.destroy()
}
